//handlers-------------------------------------------------
#include "contextMenu.h"

class contectMenuHandler : public eventHandler{
public:
    contectMenuHandler(contextMenu* m) : handled(m){}
    bool onEvent(SDL_Event* e){
        if(e->type == SDL_MOUSEBUTTONDOWN){
            SDL_Event pass;
            pass.type = SDL_USEREVENT;
            pass.user.code = 1;
            pass.user.type = menuSelect;
            controll::getScrManager()->getActiveScreen()->onEvent(&pass);
        }
        if(e->type == SDL_MOUSEMOTION){
        }
    }
private:
    contextMenu* handled;
};
//handlers=================================================
//contextMenu----------------------------------------------
contextMenu::contextMenu(int menuTag, string* str, int strs) : screen(40, strs * 20){
    tag = menuTag;
    items = new string[strs];
    for(int i = 0; i < strs; i++){
        
    }
    setBackground(125, 125, 125);
}
void contextMenu::draw(){
    if(!getVisible()) return;
    SDL_FillRect(drawSurface, NULL, bgCol);
    SDL_BlitSurface(drawSurface, &drawPosition, window, &windowPosition);
}
int contextMenu::getTag(){
    return tag;
}
void contextMenu::setHighLighted(int x, int y){

}
void contextMenu::setHighlighted(int i){
    if(i >= 0 && i < numStrs)
        highlighted = i;
}
void contextMenu::setHighlightColor(float r, float g, float b){
    
}
void contextMenu::onActivate(SDL_Surface* s){
    window = s;
}
void contextMenu::onDeactivate(){

}
//contextMenu==============================================

